<?php
/**
 * The Header for our theme.
 *
 *
 * @package WordPress
 * @subpackage Sastro
 * @since Sastro 1.0
 */
?><!DOCTYPE html>
<!--[if IE 6]>
<html id="ie6" <?php language_attributes(); ?> class="no-js">
<![endif]-->
<!--[if IE 7]>
<html id="ie7" <?php language_attributes(); ?> class="no-js">
<![endif]-->
<!--[if IE 8]>
<html id="ie8" <?php language_attributes(); ?> class="no-js">
<![endif]-->
<!--[if !(IE 6) | !(IE 7) | !(IE 8)  ]><!-->
<html <?php language_attributes(); ?> class="no-js">
<!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php nvr_document_title(); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<?php 
/* We add some JavaScript to pages with the comment form
 * to support sites with threaded comments (when in use).
 */
if ( is_singular() && get_option( 'thread_comments' ) )
	wp_enqueue_script( 'comment-reply' );

/* Always have wp_head() just before the closing </head>
 * tag of your theme, or you will break many plugins, which
 * generally use this hook to add elements to <head> such
 * as styles, scripts, and meta tags.
 */

$shortname = THE_SHORTNAME;
$initial = THE_INITIAL;

wp_head(); /* the novaro' custom content for wp_head is in includes/header-functions.php */ ?>
</head><?php 

$pid = nvr_get_postid();
$custom = nvr_get_customdata($pid);
if(isset($custom["show_breadcrumb"][0])){
	if($custom["show_breadcrumb"][0]=="true"){
		$showbc = true;
	}else{
		$showbc = false;
	}
}
$showbc = true;
$cf_enableSlider 	= (isset($custom["enable_slider"][0]))? $custom["enable_slider"][0] : "";

if($cf_enableSlider=="true" && !is_search()){
	$issliderdisplayed = true;
}else{
	$issliderdisplayed = false;
}

$allmenulayout		= array('nvrmenu1','nvrmenu2','nvrmenu3');
$menulayout			= nvr_get_option( $shortname . '_menu_style');
if(function_exists('simpleSessionGet') && nvr_get_option( $shortname . '_demo_mode' )=="1"){
	$menulayout = simpleSessionGet('menu_layout', 'nvrmenu1');
}
$cf_menuLayout	 	= (isset($custom["menu_layout"][0]))? $custom["menu_layout"][0] : $menulayout;

if(!in_array($cf_menuLayout,$allmenulayout)){
	$cf_menuLayout = 'nvrmenu1';
}
if(function_exists('simpleSessionSet') && nvr_get_option( $shortname . '_demo_mode' )=="1"){
	simpleSessionSet('menu_layout', $cf_menuLayout);
}
$txtContainerWidth = nvr_get_bodycontainer();

$bodyclass = array($shortname);  
$bodyclass[] = $cf_menuLayout;
if($issliderdisplayed){
	$bodyclass[] = 'nvrslideron';
}

if($txtContainerWidth>1100){
	$bodyclass[] = 'nvr1100more';
}
?>
<body <?php body_class($bodyclass); ?>>

<div id="subbody">
	<div id="outercontainer">
    
        <!-- HEADER -->
        <header id="outertop">
            <div id="outerheader">
                <div class="topcontainer container">
                    <div class="row">
                    	<div class="logo columns"><?php nvr_logo(); // print the logo html ?></div>
                        <section class="navigation">
                            <a class="nav-toggle fa fa-bars"></a>
                            <nav>
                            <?php wp_nav_menu( array(
                              'container'       => 'ul', 
                              'menu_class'      => 'topnav sf-menu', 
                              'depth'           => 0,
                              'sort_column'    => 'menu_order',
                              'fallback_cb'     => 'nav_page_fallback',
                              'theme_location' => 'mainmenu' 
                              )); 
                            ?>
                            </nav><!-- nav -->	
                            <div class="clearfix"></div>
                        </section>
                        <div class="clearfix"></div>
                    </div>
                </div>
            </div>

            <!-- AFTER HEADER -->
            <div id="outerafterheader">
                <div class="container">
                    <div id="afterheader" class="row">
                        <section id="pagetitlecontainer" class="twelve columns">
                            <?php
							
							$sitename =  nvr_get_option( $shortname . '_site_name');
							$tagline = nvr_get_option( $shortname . '_tagline');
							
							if($sitename=="") $sitename = get_bloginfo('name');
							if($tagline=="") $tagline = get_bloginfo('description');
                            
							if(is_home()){
								echo '<h1 class="pagetitle">'.$sitename.'</h1>';
							}else{
								get_template_part( 'title');
                            }
							$pagedesc = (isset($custom['_'.$initial.'_pagedesc'][0]) && $custom['_'.$initial.'_pagedesc'][0]!="")? $custom['_'.$initial.'_pagedesc'][0] : $tagline;
							if($pagedesc){
								echo '<span class="pagedesc">'.$pagedesc.'</span>';
							}
                            ?>
                        </section>
                        <div class="clearfix"></div>
                    </div>
                </div>
            </div>
            <!-- END AFTER HEADER -->
            
            <div id="outerheaderauthor">
            	<div class="container">
                	<div id="headerauthor" class="row">
                    	<div class="headerinfo eight columns">
							<?php
                                nvr_output_showavatar();
                                $pretext = __('Follow Me', THE_LANG);
                                nvr_output_socialicon($pretext); /* file: engine/header-functions.php */
                            ?>
                        </div>
                        <div class="topsearch four columns">
                        <?php 
							nvr_output_searchbox(); /* file: engine/header-functions.php */
						?>
                        </div>
                    </div>
                </div>
            </div>
		</header>
        <!-- END HEADER -->
        
        <!-- MIDDLE -->
        <div id="outermiddle">
        <!-- SECTION BUILDER BEFORE CONTENT -->
		<?php 
		$sectionbuilderb = array();
		if(isset( $custom['_'.$initial.'_sectionbuilder_before'][0] )){
			$sectionbuilderb = unserialize($custom['_'.$initial.'_sectionbuilder_before'][0]);
		}
		
        nvr_section_builder($sectionbuilderb);
        ?>
        <!-- END SECTION BUILDER BEFORE CONTENT -->
        
        <?php
		$pagelayout = nvr_get_sidebar_position($pid);
				
		if($pagelayout!='one-col'){
			$mcontentclass = "hassidebar";
			if($pagelayout=="two-col-left"){
				$mcontentclass .= " mborderright";
			}else{
				$mcontentclass .= " mborderleft";
			}
		}else{
			$mcontentclass = "twelve columns nosidebar";
		}
		?>
        <!-- MAIN CONTENT -->
        <div id="outermain">
        	<div id="main-gradienttop">
        	<div class="container">
            	<div class="row">
                
                <section id="maincontent" class="<?php echo $mcontentclass; ?>">
                
                <?php if($pagelayout!='one-col'){ ?>
                        
                    <section id="content" class="eight columns <?php if($pagelayout=="two-col-left"){echo "positionleft";}else{echo "positionright";}?>">
                        <div class="main">
                
                <?php } ?>
                	